<?php
namespace BP\Frm;
require_once("BP/En/Map.php");
require_once("java/io/IOException.php");
class MethodFunc extends EntityMyPK {
	public function getFrmID () 
	{
		return $this->GetValStringByKey(MethodAttr::$FrmID);
	}
	public function setFrmID ($value) // [String value]
	{
		$this->SetValByKey(MethodAttr::$FrmID, $value);
	}
	public function getMethodID () 
	{
		return $this->GetValStringByKey(MethodAttr::$MethodID);
	}
	public function setMethodID ($value) // [String value]
	{
		$this->SetValByKey(MethodAttr::$MethodID, $value);
	}
	public function getMethodName () 
	{
		return $this->GetValStringByKey(MethodAttr::$MethodName);
	}
	public function setMethodName ($value) // [String value]
	{
		$this->SetValByKey(MethodAttr::$MethodName, $value);
	}
	public function getMsgErr () 
	{
		return $this->GetValStringByKey(MethodAttr::$MsgErr);
	}
	public function setMsgErr ($value) // [String value]
	{
		$this->SetValByKey(MethodAttr::$MsgErr, $value);
	}
	public function getMsgSuccess () 
	{
		return $this->GetValStringByKey(MethodAttr::$MsgSuccess);
	}
	public function setMsgSuccess ($value) // [String value]
	{
		$this->SetValByKey(MethodAttr::$MsgSuccess, $value);
	}
	public function getMethodDoc_Url () 
	{
		$s = $this->GetValStringByKey(MethodAttr::$MethodDoc_Url);
		if (($DataType->IsNullOrEmpty($s) ==  TRUE ))
		{
			$s = "http://192.168.0.100/MyPath/xxx.xx";
		}
		return $s;
	}
	public function setMethodDoc_Url ($value) // [String value]
	{
		$this->SetValByKey(MethodAttr::$MethodDoc_Url, $value);
	}
	public function getMethodDoc_SQL () 
	{
		$strs = $this->GetBigTextFromDB("SQLScript");
		if ((($strs . NULL) . ($strs->equals("") ==  TRUE )))
		{
			return $this->getMethodDoc_SQL_Demo();
		}
		return $strs;
	}
	public function setMethodDoc_SQL ($value) // [String value]
	{
		$this->SaveBigTxtToDB("SQLScript", $value);
	}
	public function getMethodDoc_JavaScript_Demo () 
	{
		$file = ($SystemConfig->getCCFlowAppPath() . "WF/CCBill/Admin/MethodDocDemoJS.txt");
		$doc = $DataType->ReadTextFile($file);
		$doc = $doc->replace("/#", "+");
		$doc = $doc->replace("/$", "-");
		$doc = $doc->replace("@FrmID", $this->getFrmID());
		return $doc;
	}
	public function getMethodDoc_SQL_Demo () 
	{
		$file = ($SystemConfig->getCCFlowAppPath() . "WF/CCBill/Admin/MethodDocDemoSQL.txt");
		$doc = $DataType->ReadTextFile($file);
		$doc = $doc->replace("@FrmID", $this->getFrmID());
		return $doc;
	}
	public function Gener_MethodDoc_JavaScript () 
	{
		return $this->getMethodDoc_JavaScript();
	}
	public function Gener_MethodDoc_JavaScript_function () 
	{
		$paras = "";
		$attrs = new MapAttrs($this->getMyPK());
		foreach ($attrs->ToJavaList() as $item) 		{
			$paras += ($item->getKeyOfEn() . ",");
		}
		if (($attrs->size() > 1))
		{
			$paras = $paras->substring(0, ($paras->length() - 1));
		}
		$strs = ((((" function " . $this->getMethodID()) . "(") . $paras) . ") {");
		$strs += $this->getMethodDoc_JavaScript();
		$strs += "}";
		return $strs;
	}
	public function Gener_MethodDoc_SQL () 
	{
		return $this->getMethodDoc_SQL();
	}
	public function getMethodDoc_JavaScript () 
	{
		$strs = $this->GetBigTextFromDB("JSScript");
		if ((($strs . NULL) . ($strs->equals("") ==  TRUE )))
		{
			return $this->getMethodDoc_JavaScript_Demo();
		}
		$strs = $strs->replace("/#", "+");
		$strs = $strs->replace("/$", "-");
		return $strs;
	}
	public function setMethodDoc_JavaScript ($value) // [String value]
	{
		$this->SaveBigTxtToDB("JSScript", $value);
	}
	public function getMethodDocTypeOfFunc () 
	{
		return $this->GetValIntByKey(MethodAttr::$MethodDocTypeOfFunc);
	}
	public function setMethodDocTypeOfFunc ($value) // [int value]
	{
		$this->SetValByKey(MethodAttr::$MethodDocTypeOfFunc, $value);
	}
	public function getRefMethodType () 
	{
		return $RefMethodType->forValue($this->GetValIntByKey(MethodAttr::$RefMethodType));
	}
	public function setRefMethodType ($value) // [RefMethodType value]
	{
		$this->SetValByKey(MethodAttr::$RefMethodType, $value->getValue());
	}
	public function getHisUAC () 
	{
		$uac = new UAC();
		if ($WebUser->getIsAdmin())
		{
			$uac->IsUpdate =  TRUE ;
			return $uac;
		}
		return parent->getHisUAC();
	}
	public static function constructor__ () 
	{
		$me = new self();
		return $me;
	}
	public static function constructor__String ($mypk) // [String mypk]
	{
		$me = new self();
		$me->setMyPK($mypk);
		$me->Retrieve();
		return $me;
	}
	public function getEnMap () 
	{
		if (($this->get_enMap() != NULL))
		{
			return $this->get_enMap();
		}
		$map = new Map("Frm_Method", "功能方法");
		$map->AddMyPK();
		$map->AddTBString(MethodAttr::$FrmID, NULL, "表单ID",  TRUE ,  TRUE , 0, 300, 10);
		$map->AddTBString(MethodAttr::$MethodName, NULL, "方法�?",  TRUE ,  FALSE , 0, 300, 10,  TRUE );
		$map->AddTBString(MethodAttr::$MethodID, NULL, "方法ID",  TRUE ,  TRUE , 0, 300, 10);
		$map->AddDDLSysEnum(MethodAttr::$WhatAreYouTodo, 0, "执行完毕后干啥？",  TRUE ,  TRUE , MethodAttr::$WhatAreYouTodo, "@0=关闭提示窗口@1=关闭提示窗口并刷新@2=转入到Search.htm页面上去");
		$map->AddTBString(MethodAttr::$WarningMsg, NULL, "功能执行警告信息",  TRUE ,  FALSE , 0, 300, 10,  TRUE );
		$map->AddDDLSysEnum(MethodAttr::$ShowModel, 0, "显示方式",  TRUE ,  TRUE , MethodAttr::$ShowModel, "@0=按钮@1=超链�?");
		$map->AddDDLSysEnum(MethodAttr::$MethodDocTypeOfFunc, 0, "内容类型",  TRUE ,  FALSE , "MethodDocTypeOfFunc", "@0=SQL@1=URL@2=JavaScript@3=业务单元");
		$map->AddTBString(MethodAttr::$MethodDoc_Url, NULL, "URL执行内容",  FALSE ,  FALSE , 0, 300, 10);
		$map->AddTBString(MethodAttr::$MsgSuccess, NULL, "成功提示信息",  TRUE ,  FALSE , 0, 300, 10,  TRUE );
		$map->AddTBString(MethodAttr::$MsgErr, NULL, "失败提示信息",  TRUE ,  FALSE , 0, 300, 10,  TRUE );
		$map->AddTBInt(MethodAttr::$PopHeight, 100, "弹窗高度",  TRUE ,  FALSE );
		$map->AddTBInt(MethodAttr::$PopWidth, 260, "弹窗宽度",  TRUE ,  FALSE );
		$map->AddBoolean(MethodAttr::$IsMyBillToolBar,  TRUE , "是否显示在MyBill.htm工具栏上",  TRUE ,  TRUE ,  TRUE );
		$map->AddBoolean(MethodAttr::$IsMyBillToolExt,  FALSE , "是否显示在MyBill.htm工具栏右边的更多按钮�?",  TRUE ,  TRUE ,  TRUE );
		$map->AddBoolean(MethodAttr::$IsSearchBar,  FALSE , "是否显示在Search.htm工具栏上(用于批处�?)",  TRUE ,  TRUE ,  TRUE );
		$rm = new RefMethod();
		$rm->Title = "方法参数";
		$rm->ClassMethodName = ($this . ".DoParas");
		$rm->Visable =  TRUE ;
		$rm->refMethodType = $RefMethodType->RightFrameOpen;
		$rm->Target = "_blank";
		$map->AddRefMethod($rm);
		$rm = new RefMethod();
		$rm->Title = "方法内容";
		$rm->ClassMethodName = ($this . ".DoDocs");
		$rm->Visable =  TRUE ;
		$rm->refMethodType = $RefMethodType->RightFrameOpen;
		$rm->Target = "_blank";
		$map->AddRefMethod($rm);
		$this->set_enMap($map);
		return $map;
	}
	public function DoParas () 
	{
		return ("../../CCBill/Admin/MethodParas.htm?MyPK=" . $this->getMyPK());
	}
	public function DoDocs () 
	{
		return ("../../CCBill/Admin/MethodDoc.htm?MyPK=" . $this->getMyPK());
	}
}
?>
